//
// Decompiled by Jadx - 376ms
//
package r;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import androidx.appcompat.widget.z;

public final class a {
    public static PackageInfo a(Context context, String str) throws Exception {
        if (context == null) {
            throw new Exception("context is null");
        }
        PackageManager packageManager = context.getPackageManager();
        if (packageManager != null) {
            return Build.VERSION.SDK_INT >= 33 ? packageManager.getPackageInfo(str, PackageManager.PackageInfoFlags.of(0L)) : packageManager.getPackageInfo(str, 0);
        }
        throw new Exception("PackageManager is null");
    }

    public static long b(Context context, String str) throws Exception {
        return Build.VERSION.SDK_INT >= 28 ? z.e(a(context, str)) : r2.versionCode;
    }
}
